package com.taxsystem.yehao.activity;

import java.util.HashMap;
import java.util.List;

import android.app.Activity;
import android.os.Handler;
import android.os.Message;
import android.view.Menu;
import android.view.View;
import android.widget.Adapter;
import android.widget.ListView;
import android.widget.ProgressBar;
import android.widget.SimpleAdapter;

public class BaseListActivity extends Activity {
	protected ListView lv = null;
	protected SimpleAdapter simpleAdapter = null;
	protected ProgressBar progressBar = null;
	protected int MY_NOTICE = 0x111;
	protected int NAV_SETTING = 0x112;
	protected int ACCOUNT_SETTING = 0x113;
	protected int INDIVIDUAL_SETTING = 0x114;
	protected Handler handler =new Handler(){
		@Override
		public void handleMessage(Message msg){
		super.handleMessage(msg);
		switch (msg.what) {
		case 0:lv.setAdapter(simpleAdapter);break;
		case 1:progressBar.setVisibility(View.VISIBLE);break;
		case 2:progressBar.setVisibility(View.INVISIBLE);break;
		}
		
		}
		};
		public void setListAdapter() {
			handler.sendEmptyMessage(0);
		}
		public void setProcessBarVisible(boolean flag) {
			if(flag)handler.sendEmptyMessage(1);
			else handler.sendEmptyMessage(2);
		}
		@Override
		public boolean onCreateOptionsMenu(Menu menu) {
			// Inflate the menu; this adds items to the action bar if it is present.
			//getMenuInflater().inflate(R.menu.activity_mian, menu);
			menu.add(0, MY_NOTICE, 0, "我的通知");
			menu.add(0, NAV_SETTING, 0, "导航设置");
			menu.add(0, ACCOUNT_SETTING, 0, "帐号设置");
			menu.add(0, INDIVIDUAL_SETTING, 0, "个性化设置");
			return true;
		}
}
